<?php
declare(strict_types=1);

namespace app\common\lib;

class Time
{
    /**
     * 用户登录状态过期时间
     *
     * @param int $type
     * @return float|int
     */
    public static function userLoginExpiresTime(int $type)
    {
        $day = 0;
        switch ($type)
        {
            case 1: $day = $type * 7; break;
            case 2:
            default: $day = $type * 30;
        }
        return $day * 24 * 3600;
    }

    /**
     * 获取订单失效时间
     *
     * @return int|mixed
     */
    public static function orderInvalidTime()
    {
        return time() + config('redis.order.order_expire');
    }
}